/**
 *
 */
moduleMain.controller("DashboardUserBadgeInfo", function (UserBadgeResource, $stateParams, $scope, $log, $state, GeneralResource, LoadingService, ConstantService, DialogService) {
    initPage($scope);
    $scope.$on("$viewContentLoaded", function () {
        pageOnLoad($scope);
        $scope.currentState = $state.current;
        if ($scope.currentState.name === $state.current) {
            ConstantService.addState($state.current, true);
        }
        $scope.user = ConstantService.getItem('user');
        if ($stateParams.organizationClientId) {
            $scope.currentOrganizationClientId = $stateParams.organizationClientId;
        } else {
            $scope.currentOrganizationClientId = $scope.user.createOrgId;
        }
        $scope.query(1);
    });

    $scope.query = function (pageNo) {
        //LoadingService.show();
        UserBadgeResource.query({pageNo: pageNo - 1, pageSize: 10, organizationClientId: $scope.currentOrganizationClientId}, {}, function (queryResult) {
            $log.debug("查询结果", queryResult.data);
            $scope.queryResult = queryResult.data;
            $scope.pagination.setPage(queryResult.data, pageNo);
            //LoadingService.hide();
        });
    };
    $scope.pagination = new Pagination();
    $scope.pagination.setPageClickFn($scope.query);
});